var util = require('./we7/resource/utils/util.js');
var QQMapWX = require('/we7/resource/utils/qqmap-wx-jssdk.js');
var qqmapsdk;
App({
    globalData:{
      StatusBar:123123,
      number:0,
      url: 'https://wq.sitedown.top/attachment/',
      getPosution:''
    },
    onLaunch: function (res) {
     
    },
    onShow: function (res) {
    },
    onHide: function () {
    },
    onError: function (msg) {
        console.log(msg)
    },
    //加载微擎工具类
    util: util,
    //导航菜单，微擎将会自己实现一个导航菜单，结构与小程序导航菜单相同
    //用户信息，sessionid是用户是否登录的凭证
    userInfo: {
        sessionid: null,
    },
  //  自定义tabbar
  tabbar: {
    color: "#242424",
    selectedColor: "#F66708",
    backgroundColor: "#ffffff",
    borderStyle: "#d7d7d7",
    list: [
      {
        index: "0",
        pagePath: "/we7/pages/index/index",
        text: "首页",
        iconPath: "https://wq.sitedown.top/attachment/images/images//shouYe.png",
        selectedIconPath: "https://wq.sitedown.top/attachment/images/images//shouYe(1).png",
        selected: true
      },
      // {
      //   index: "1",
      //   pagePath: "/we7/pages/pinTuan/pinTuan",
      //   text: "拼团",
      //   iconPath: "https://wq.sitedown.top/attachment/images/images//pinTuan.png",
      //   selectedIconPath: "https://wq.sitedown.top/attachment/images/images//pinTuan(1).png",
      //   selected: false
      // },
      {
        index: "2",
        pagePath: "/we7/pages/fenLei/fenLei",
        text: "分类",
        iconPath: "https://wq.sitedown.top/attachment/images/images//fenLei.png",
        selectedIconPath: "https://wq.sitedown.top/attachment/images/images//fenLei(1).png",
        selected: false
      },
      {
        index: "3",
        dott: "55",
        pagePath: "/we7/pages/shoping/shoping",
        text: "购物车",
        iconPath: "https://wq.sitedown.top/attachment/images/images//shoping.png",
        selectedIconPath: "https://wq.sitedown.top/attachment/images/images//shoping(1).png",
        selected: false
      },
      {
        index: "4",
        pagePath: "/we7/pages/mine/mine",
        text: "我的",
        iconPath: "https://wq.sitedown.top/attachment/images/images//mine.png",
        selectedIconPath: "https://wq.sitedown.top/attachment/images/images//mine(1).png",
        selected: false
      }
    ],
    position: "bottom"
  },
  changeTabBar: function () {
    var _curPageArr = getCurrentPages();
    var _curPage = _curPageArr[_curPageArr.length - 1];
    var _pagePath = _curPage.__route__;
    if (_pagePath.indexOf('/') != 0) {
      _pagePath = '/' + _pagePath;
    }
    var tabBar = this.tabbar;
    for (var i = 0; i < tabBar.list.length; i++) {
      // console.log(_pagePath + '--' + tabBar.list[i].pagePath)
      tabBar.list[i].selected = false;
      if (tabBar.list[i].pagePath == _pagePath) {
        tabBar.list[i].selected = true;//根据页面地址设置当前页面状态  
      }
    }
    _curPage.setData({
      tabbar: tabBar
    });
  },
    siteInfo: require('siteinfo.js')
});